package com.whpost.service.dao.cwqf;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.whpost.service.entity.cwqf.TCwqfKhjlKh;
import com.whpost.service.entity.cwqf.TCwqfTeam;
import com.whpost.service.entity.cwqf.TbCrmCustomer;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author YinZhuoyi
 * @since 2025-08-29
 */
public interface TCwqfKhjlKhMapper extends BaseMapper<TCwqfKhjlKh> {

    @Select("select * from t_cwqf_khjl_kh where ${ew.sqlSegment}")
    @Results(id="tCwqfKhjlKhMap",value = {
            @Result(column="party_code",property="tbCrmCustomer",
                    one=@One(
                            select="com.whpost.service.dao.cwqf.TbCrmCustomerMapper.selectByCode")
            ),
            @Result(column="czy_code",property="hsCzy",
                    one=@One(
                            select="com.whpost.service.dao.cwqf.HsCzyMapper.selectByCode")
            ),
            @Result(column="czy_code",property="czyCode"),
            @Result(column="party_code",property="partyCode")
    })
    IPage<TCwqfKhjlKh> getTCwqfKhjlKhPage(Page<TCwqfKhjlKh> page, @Param("ew") QueryWrapper wrapper);

    @Select("select * from t_cwqf_khjl_kh where czy_code=#{czyCode}")
    @ResultMap(value="tCwqfKhjlKhMap")
    TCwqfKhjlKh getTCwqfKhjlKhByCzyCode(@Param("czyCode") String czyCode);

}
